package com.iatinspur.learn;



import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;


/**
 * 25集 ：直接内存
 *       NIO
 *
 *
 *  java.lang.OutOfMemoryError: Direct buffer memory
 *  -XX:MaxDirectMemorySize= 1024k
 *
 *
 *
 */
public class Learn_22_JVM {


    public static int size =1024*1024*100;

    public static List<ByteBuffer> list = new ArrayList<ByteBuffer>();

    public static int  count = 0;


    public static void main(String[] args) throws IOException, InterruptedException {
        System.in.read();

        while (true){

            ByteBuffer bb =ByteBuffer.allocateDirect(size);
            list.add(bb);
            System.out.println(++count);
          //  Thread.sleep(5000);
        }



    }



}








